<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>regexp</title>
</head>
<body>
	<div>
		<textarea id="content"></textarea>
		<input type="button" id="btn" value="Btn">
	</div>
	<script>
		window.onload = _ => {
			// 找寻字符串中连续的四个数字
			(_=> {
				const input = document.querySelector('#content')
				const btn = document.querySelector('#btn')
				const reg = /\d{4}/gi
				btn.onclick = ev => {
					const val = input.value
					let res ;
					console.log(reg.exec(val),reg.exec(val))
					// while(res = reg.exec(val) ) {
					// 	console.log(res)
					// }


				}
			})()
		}
	</script>
</body>
</html>